package org.example.fronted.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.example.entity.Orders;

import java.math.BigDecimal;
import java.sql.Connection;
import java.util.Date;
import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Orders> {

    Integer insertOrder(@Param("oderNo") String orderNo, @Param("price") BigDecimal price,
                        @Param("num") Integer num, @Param("goodsImg") String goodsImg,
                        @Param("goodsTitle") String goodsTitle,
                        @Param("orderStatus") Integer orderStatus,
                        @Param("appraiseStatus") Integer appraiseStatus,
                        @Param("userId") Integer userId,
                        @Param("creatTime") Date creatTime, @Param("goodId") Integer goodId);

    Integer insertOrderAddress(@Param("orderNo") String orderNo,
                               @Param("orderAddress") Integer defaultTakeDeliveryAddressId);

    List<Orders> getOrdersOfOrderNo(String orderNo);

    List<Orders> getOrdersByStatus(@Param("status") Integer status, @Param("userId") Integer userId);

    Integer updateOrdersStatus(@Param("orderNo") String orderNo,
                               @Param("newStatus") Integer newStatus,
                               @Param("payTime") Date date);
}
